package com.study.javaFx.model;

import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

@JsonIgnoreProperties(ignoreUnknown = true)
public class User {

    private final IntegerProperty userId;
    private final StringProperty name;
    private final StringProperty contact;
    private final StringProperty studentId;

    public User(int userId, String name, String contact, String studentId) {
        this.userId = new SimpleIntegerProperty(userId);
        this.name = new SimpleStringProperty(name);
        this.contact = new SimpleStringProperty(contact);
        this.studentId = new SimpleStringProperty(studentId);
    }

    public User() {
        this.userId = new SimpleIntegerProperty(0);
        this.name = new SimpleStringProperty("");
        this.contact = new SimpleStringProperty("");
        this.studentId = new SimpleStringProperty("");
    }

    // --- Getters and Property Getters ---

    @JsonProperty("userId")
    public int getUserId() { return userId.get(); }
    @JsonProperty("userId")
    public void setUserId(int id) { this.userId.set(id); }
    public IntegerProperty userIdProperty() { return userId; }

    @JsonProperty("name")
    public String getName() { return name.get(); }
    @JsonProperty("name")
    public void setName(String s) { this.name.set(s); }
    public StringProperty nameProperty() { return name; }

    @JsonProperty("contact")
    public String getContact() { return contact.get(); }
    @JsonProperty("contact")
    public void setContact(String s) { this.contact.set(s); }
    public StringProperty contactProperty() { return contact; }

    @JsonProperty("studentId")
    public String getStudentId() { return studentId.get(); }
    @JsonProperty("studentId")
    public void setStudentId(String s) { this.studentId.set(s); }
    public StringProperty studentIdProperty() { return studentId; }
} 